package com.business.web.spring;

import com.common.utils.DateUtil;

import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date;

public class Test {
    public static void main(String[] args) throws ParseException {
        Date date  = DateUtil.addMonth(DateUtil.parseByDefaultDatePattern("2021-05-27"), 1);
        System.out.println("------date=" + DateUtil.format( date, "yyyy-MM-dd" ));
        Date date2  = DateUtil.addDay(DateUtil.parseByDefaultDatePattern("2021-05-27"), -1);
        System.out.println("------date2=" + DateUtil.format( date2 , "yyyy-MM-dd" ));
        System.out.println("------date 与date2相差几天=" +DateUtil.getDiffDate(date2, date));
        BigDecimal barea = new BigDecimal(10.00);
        BigDecimal bprice = new BigDecimal(100.11);
        BigDecimal bdays = new BigDecimal(100.00);

        String ted = barea.multiply(bprice).multiply(bdays).setScale(2,BigDecimal.ROUND_HALF_UP).toString();  //保留两位小数
        System.out.println("------bigdecimal=" +ted);

    }

}
